<template>
	<view class="contain">
		<view class=""  style="margin-top: 20px;">
			<swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
				<swiper-item v-for="(item,index) in bannerlist" :key="index">
					<view class="swiper-item">
						<image style="width: 100%; height: 170px;" :src="base+item.rotationMap" mode="aspectFill"></image>
					</view>
				</swiper-item>
				</swiper>
		</view>
		<!-- 全部服务 -->
		<view class="server">
			<view @click="tiao(index)" v-for="(item,index) in serverlist" :key="index">
				<view>
					<image style="width: 100rpx;" :src="base+item.applicationLogo" mode="widthFix"></image>
				</view>
				<view style="text-align: center;">
					{{item.applicationLabel}}
				</view>
			</view>
		</view>
		<!--  -->
		
		<!-- 课程列表 -->
		<view class="" style="margin-top: 30rpx;">
			<uni-list>
				<uni-list-item v-for="(item,index) in classlist" :key="index" :title="item.subjectName" :note="'第'+item.whatClass+'节课    '+'   上课班级'+item.classname">
					<template v-slot:footer>
						<view class="" v-if="item.state==1">课程准备</view>
						<view class="" v-else-if="item.state==2">授课中</view>
						<view class="" v-else>课程结束</view>
					</template>
				</uni-list-item>
			</uni-list>
			
		</view>
		
		
		<!--  -->
			
		
	</view>
</template>

<script>
	import * as request from '@/unitl.js'
	export default {
		data() {
			return {
				formdata:{
					username:"rx",
					password:'123456'
				},
				base:'',
				serverlist:[],
				bannerlist:[],
				classlist:[],
				href: 'https://uniapp.dcloud.io/component/README?id=uniui'
			}
		},
		onLoad() {
			this.base=request.default.baseurl
			this.getbanner()
			this.getserverlist()
			this.getclasslist()
		},
		methods: {
			tiao(e){
				switch(e){
					case 0:uni.navigateTo({
						url:"/pages/user/user"
					});break;
					case 3:uni.navigateTo({
						url:"/pages/past/past"
					});break;
					case 2:uni.navigateTo({
						url:"/pages/leave/leave"
					});break;
					case 5:uni.navigateTo({
						url:'/pages/card/card'
					})
				}
			},
			async getclasslist(){
				const res =await request.default.getmanage()
				console.log(res)
				this.classlist=res.data.rows
				
			},

			async getserverlist(){
				const res=await request.default.getapplist()
				console.log(res)
				this.serverlist=res.data.rows
			},
			
			
			async getbanner(){
				const res=await request.default.getbanner()
				// console.log(res)
				this.bannerlist=res.data.rows
			},
			

		}
	}
</script>

<style>
	.server{
		margin-top: 20px;
		display: grid;
		gap: 10rpx;
		font-size: 10px;
		text-align: center;
		grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
	}
	.gong{
		margin-top: 40rpx;
		display: grid;
		grid-template-columns: repeat(6,1fr);
		gap: 30rpx;
		text-align: center;
		font-size: 16rpx;
	}
	
</style>
